package com.todo.common.common.enums.biz;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * @author azhebuxing
 * @date 2024/4/23 10:25
 * @description
 */
@Getter
@AllArgsConstructor
public enum PrivateTypeEnum {

    PUBLIC(0, "PUBLIC", "公开"),
    PRIVATE(1, "PRIVATE", "私有"),
    FRIENDS_PUBLIC(2, "FRIENDS_PUBLIC", "朋友圈公开"),
    FRIENDS_PRIVATE(3, "FRIENDS_PRIVATE", "朋友圈私有"),
    ;

    private static Map<Integer, PrivateTypeEnum> typeMap = Arrays
            .stream(PrivateTypeEnum.values())
            .collect(Collectors.toMap(PrivateTypeEnum::getType, item -> item, (v1, v2) -> v2));

    private int type;
    private String code;
    private String name;


    public static PrivateTypeEnum getByType(Integer type) {
        return typeMap.get(type);
    }
}
